/**
 * 
 */
package com.unsanctioned.radioagregator.fragments;

import com.unsanctioned.radioaggregator.R;
import com.unsanctioned.radioagregator.MainActivity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;

/**
 * @author wizard
 *
 */
public class MenuFragment extends Fragment {
	private Context context = null;
	private OnMenuSelectedListener mOnMenuSelectedListener;
	
	public MenuFragment() {
		// TODO Auto-generated constructor stub
	}
	
	public interface OnMenuSelectedListener {
		public void onMenuSelected();
	}
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		context = MainActivity.getMainContext();
	}
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		if (inflater == null) inflater = LayoutInflater.from(MainActivity.getMainContext());
		View menuFragmentView = inflater.inflate(R.menu.main, container, false);
		menuFragmentView.findViewById(R.id.home_button).setOnTouchListener(new OnTouchListener() {
			
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				Toast.makeText(context, "Home", Toast.LENGTH_SHORT).show();
				return false;
			}
		});
		menuFragmentView.findViewById(R.id.agenda_button).setOnTouchListener(new View.OnTouchListener() {
			
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				Toast.makeText(context, "Agenda", Toast.LENGTH_SHORT).show();
				return false;
			}
		});
		menuFragmentView.findViewById(R.id.podcast_button).setOnTouchListener(new View.OnTouchListener() {
			
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				Toast.makeText(context, "Podcast", Toast.LENGTH_SHORT).show();
				return false;
			}
		});
		menuFragmentView.findViewById(R.id.member_button).setOnTouchListener(new View.OnTouchListener() {
			
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				Toast.makeText(context, "Member", Toast.LENGTH_SHORT).show();
				return false;
			}
		});
		return menuFragmentView;
	}
	
	@Override
	public void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
	}
	
	@Override
	public void onAttach(Activity activity) {
		// TODO Auto-generated method stub
		super.onAttach(activity);
		try {
			mOnMenuSelectedListener = (OnMenuSelectedListener) activity;
		} catch (ClassCastException e) {
			throw new ClassCastException(activity.toString() + " needs to implement interface: OnMenuSelectedListener");
		}
	}
	
	@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
		// TODO Auto-generated method stub
		super.onActivityResult(requestCode, resultCode, data);
	}
}
